#tag Class
Class NSCharacterSet
Inherits NSObject
	#tag Method, Flags = &h0
		Function AllowedCharacters() As string
		  #if TargetMacOS
		    dim mb as MemoryBlock
		    dim value as integer
		    dim result as string = DefineEncoding( "", Encodings.UTF16 )
		    
		    mb = me.BitmapRepresentation.Data
		    
		    for byteNbr as integer = 0 to 8191
		      value = mb.Byte( byteNbr )
		      
		      for bitNbr as integer = 0 to 7
		        if  BitWise.BitAnd( value, Pow( 2, bitNbr ))<>0 then
		          result = result + Encodings.UTF16.Chr( byteNbr * 8 + bitNbr )
		        end if
		      next
		    next
		    
		    return  result
		  #endif
		End Function
	#tag EndMethod

	#tag Method, Flags = &h0
		 Shared Function AlphanumericCharacterSet() As NSCharacterSet
		  
		  #if TargetMacOS
		    declare function alphanumericCharacterSet lib CocoaLib selector "alphanumericCharacterSet" (obj_id as Ptr) as Ptr
		    
		    dim charSetRef as Ptr = alphanumericCharacterSet(ClassRef)
		    if charSetRef <> nil then
		      return new NSCharacterSet(charSetRef)
		    end if
		    
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h0
		Function BitmapRepresentation() As NSData
		  
		  #if TargetMacOS
		    declare function bitmapRepresentation lib CocoaLib selector "bitmapRepresentation" (obj_id as Ptr) as Ptr
		    
		    dim dataRef as Ptr = bitmapRepresentation(self)
		    if dataRef <> nil then
		      return new NSData(dataRef)
		    end if
		    
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h0
		 Shared Function CapitalizedLetterCharacterSet() As NSCharacterSet
		  
		  #if TargetMacOS
		    declare function capitalizedLetterCharacterSet lib CocoaLib selector "capitalizedLetterCharacterSet" (obj_id as Ptr) as Ptr
		    
		    dim charSetRef as Ptr = capitalizedLetterCharacterSet(ClassRef)
		    if charSetRef <> nil then
		      return new NSCharacterSet(charSetRef)
		    end if
		    
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h0
		Function CharacterIsMember(aCharacter as UInt16) As Boolean
		  
		  #if TargetMacOS
		    declare function characterIsMember lib CocoaLib selector "characterIsMember:" (obj_id as Ptr, aCharacter as UInt16) as Boolean
		    
		    return characterIsMember(self, aCharacter)
		    
		  #else
		    #pragma unused aCharacter
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h0
		 Shared Function CharacterSetWithBitmapRepresentation(data as NSData) As NSCharacterSet
		  
		  #if TargetMacOS
		    declare function characterSetWithBitmapRepresentation lib CocoaLib selector "characterSetWithBitmapRepresentation:" (obj_id as Ptr, data as Ptr) as Ptr
		    
		    dim dataRef as Ptr
		    if data <> nil then
		      dataRef = data
		    end if
		    
		    dim charSetRef as Ptr = characterSetWithBitmapRepresentation(ClassRef, dataRef)
		    
		    if charSetRef <> nil then
		      return new NSCharacterSet(charSetRef)
		    end if
		    
		  #else
		    #pragma unused data
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h0
		 Shared Function CharacterSetWithCharactersInString(aString as String) As NSCharacterSet
		  
		  #if TargetMacOS
		    declare function characterSetWithCharactersInString lib CocoaLib selector "characterSetWithCharactersInString:" (obj_id as Ptr, aString as CFStringRef) as Ptr
		    
		    dim charSetRef as Ptr = characterSetWithCharactersInString(ClassRef, aString)
		    if charSetRef <> nil then
		      return new NSCharacterSet(charSetRef)
		    end if
		    
		  #else
		    #pragma unused aString
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h0
		 Shared Function CharacterSetWithContentsOfFile(file as FolderItem) As NSCharacterSet
		  
		  #if TargetMacOS
		    declare function characterSetWithContentsOfFile lib CocoaLib selector "characterSetWithContentsOfFile:" (obj_id as Ptr, path as CFStringRef) as Ptr
		    
		    if file <> nil then
		      dim charSetRef as Ptr = characterSetWithContentsOfFile(ClassRef, file.POSIXPath)
		      if charSetRef <> nil then
		        return new NSCharacterSet(charSetRef)
		      end if
		    end if
		    
		  #else
		    #pragma unused file
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h0
		 Shared Function CharacterSetWithRange(aRange as Cocoa.NSRange) As NSCharacterSet
		  
		  #if TargetMacOS
		    declare function characterSetWithRange lib CocoaLib selector "characterSetWithRange:" (obj_id as Ptr, aRange as Cocoa.NSRange) as Ptr
		    
		    dim charSetRef as Ptr = characterSetWithRange(ClassRef, aRange)
		    if charSetRef <> nil then
		      return new NSCharacterSet(charSetRef)
		    end if
		    
		  #else
		    #pragma unused aRange
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h21
		Private Shared Function ClassRef() As Ptr
		  
		  static ref as Ptr = Cocoa.NSClassFromString("NSCharacterSet")
		  return ref
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h0
		 Shared Function ControlCharacterSet() As NSCharacterSet
		  
		  #if TargetMacOS
		    declare function controlCharacterSet lib CocoaLib selector "controlCharacterSet" (obj_id as Ptr) as Ptr
		    
		    dim charSetRef as Ptr = controlCharacterSet(ClassRef)
		    if charSetRef <> nil then
		      return new NSCharacterSet(charSetRef)
		    end if
		    
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h0
		 Shared Function DecimalDigitCharacterSet() As NSCharacterSet
		  
		  #if TargetMacOS
		    declare function decimalDigitCharacterSet lib CocoaLib selector "decimalDigitCharacterSet" (obj_id as Ptr) as Ptr
		    
		    dim charSetRef as Ptr = decimalDigitCharacterSet(ClassRef)
		    if charSetRef <> nil then
		      return new NSCharacterSet(charSetRef)
		    end if
		    
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h0
		 Shared Function DecomposableCharacterSet() As NSCharacterSet
		  
		  #if TargetMacOS
		    declare function decomposableCharacterSet lib CocoaLib selector "decomposableCharacterSet" (obj_id as Ptr) as Ptr
		    
		    dim charSetRef as Ptr = decomposableCharacterSet(ClassRef)
		    if charSetRef <> nil then
		      return new NSCharacterSet(charSetRef)
		    end if
		    
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h0
		Function HasMemberInPlane(thePlane as UInt8) As Boolean
		  
		  #if TargetMacOS
		    declare function hasMemberInPlane lib CocoaLib selector "hasMemberInPlane:" (obj_id as Ptr, thePlane as UInt8) as Boolean
		    
		    return hasMemberInPlane(self, thePlane)
		    
		  #else
		    #pragma unused thePlane
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h0
		 Shared Function IllegalCharacterSet() As NSCharacterSet
		  
		  #if TargetMacOS
		    declare function illegalCharacterSet lib CocoaLib selector "illegalCharacterSet" (obj_id as Ptr) as Ptr
		    
		    dim charSetRef as Ptr = illegalCharacterSet(ClassRef)
		    if charSetRef <> nil then
		      return new NSCharacterSet(charSetRef)
		    end if
		    
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h0
		Function InvertedSet() As NSCharacterSet
		  
		  #if TargetMacOS
		    declare function invertedSet lib CocoaLib selector "invertedSet:" (obj_id as Ptr) as Ptr
		    
		    dim charSetRef as Ptr = invertedSet(self)
		    if charSetRef <> nil then
		      return new NSCharacterSet(charSetRef)
		    end if
		    
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h0
		Function IsSupersetOfSet(theOtherSet as NSCharacterSet) As Boolean
		  
		  #if TargetMacOS
		    declare function isSupersetOfSet lib CocoaLib selector "isSupersetOfSet:" (obj_id as Ptr, theOtherSet as Ptr) as Boolean
		    
		    dim otherSetRef as Ptr
		    if theOtherSet <> nil then
		      otherSetRef = theOtherSet
		    end if
		    return isSupersetOfSet(self, otherSetRef)
		    
		  #else
		    #pragma unused theOtherSet
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h0
		 Shared Function LetterCharacterSet() As NSCharacterSet
		  
		  #if TargetMacOS
		    declare function letterCharacterSet lib CocoaLib selector "letterCharacterSet" (obj_id as Ptr) as Ptr
		    
		    dim charSetRef as Ptr = letterCharacterSet(ClassRef)
		    if charSetRef <> nil then
		      return new NSCharacterSet(charSetRef)
		    end if
		    
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h0
		Function LongCharacterIsMember(theLongChar as UInt32) As Boolean
		  
		  #if TargetMacOS
		    declare function longCharacterIsMember lib CocoaLib selector "longCharacterIsMember:" (obj_id as Ptr, theLongChar as UInt32) as Boolean
		    
		    return longCharacterIsMember(self, theLongChar)
		    
		  #else
		    #pragma unused theLongChar
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h0
		 Shared Function LowercaseLetterCharacterSet() As NSCharacterSet
		  
		  #if TargetMacOS
		    declare function lowercaseLetterCharacterSet lib CocoaLib selector "lowercaseLetterCharacterSet" (obj_id as Ptr) as Ptr
		    
		    dim charSetRef as Ptr = lowercaseLetterCharacterSet(ClassRef)
		    if charSetRef <> nil then
		      return new NSCharacterSet(charSetRef)
		    end if
		    
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h0
		 Shared Function NewlineCharacterSet() As NSCharacterSet
		  
		  #if TargetMacOS
		    declare function newlineCharacterSet lib CocoaLib selector "newlineCharacterSet" (obj_id as Ptr) as Ptr
		    
		    dim charSetRef as Ptr = newlineCharacterSet(ClassRef)
		    if charSetRef <> nil then
		      return new NSCharacterSet(charSetRef)
		    end if
		    
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h0
		 Shared Function NonBaseCharacterSet() As NSCharacterSet
		  
		  #if TargetMacOS
		    declare function nonBaseCharacterSet lib CocoaLib selector "nonBaseCharacterSet" (obj_id as Ptr) as Ptr
		    
		    dim charSetRef as Ptr = nonBaseCharacterSet(ClassRef)
		    if charSetRef <> nil then
		      return new NSCharacterSet(charSetRef)
		    end if
		    
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h0
		 Shared Function PunctuationCharacterSet() As NSCharacterSet
		  
		  #if TargetMacOS
		    declare function punctuationCharacterSet lib CocoaLib selector "punctuationCharacterSet" (obj_id as Ptr) as Ptr
		    
		    dim charSetRef as Ptr = punctuationCharacterSet(ClassRef)
		    if charSetRef <> nil then
		      return new NSCharacterSet(charSetRef)
		    end if
		    
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h0
		 Shared Function SymbolCharacterSet() As NSCharacterSet
		  
		  #if TargetMacOS
		    declare function symbolCharacterSet lib CocoaLib selector "symbolCharacterSet" (obj_id as Ptr) as Ptr
		    
		    dim charSetRef as Ptr = symbolCharacterSet(ClassRef)
		    if charSetRef <> nil then
		      return new NSCharacterSet(charSetRef)
		    end if
		    
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h0
		 Shared Function UppercaseLetterCharacterSet() As NSCharacterSet
		  
		  #if TargetMacOS
		    declare function uppercaseLetterCharacterSet lib CocoaLib selector "uppercaseLetterCharacterSet" (obj_id as Ptr) as Ptr
		    
		    dim charSetRef as Ptr = uppercaseLetterCharacterSet(ClassRef)
		    if charSetRef <> nil then
		      return new NSCharacterSet(charSetRef)
		    end if
		    
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h0
		 Shared Function WhitespaceAndNewlineCharacterSet() As NSCharacterSet
		  
		  #if TargetMacOS
		    declare function whitespaceAndNewlineCharacterSet lib CocoaLib selector "whitespaceAndNewlineCharacterSet" (obj_id as Ptr) as Ptr
		    
		    dim charSetRef as Ptr = whitespaceAndNewlineCharacterSet(ClassRef)
		    if charSetRef <> nil then
		      return new NSCharacterSet(charSetRef)
		    end if
		    
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h0
		 Shared Function WhitespaceCharacterSet() As NSCharacterSet
		  
		  #if TargetMacOS
		    declare function whitespaceCharacterSet lib CocoaLib selector "whitespaceCharacterSet" (obj_id as Ptr) as Ptr
		    
		    dim charSetRef as Ptr = whitespaceCharacterSet(ClassRef)
		    if charSetRef <> nil then
		      return new NSCharacterSet(charSetRef)
		    end if
		    
		  #endif
		  
		End Function
	#tag EndMethod


	#tag Constant, Name = NSOpenStepUnicodeReservedBase, Type = Double, Dynamic = False, Default = \"&hF400", Scope = Public
	#tag EndConstant


	#tag ViewBehavior
		#tag ViewProperty
			Name="Description"
			Group="Behavior"
			Type="String"
			EditorType="MultiLineEditor"
			InheritedFrom="NSObject"
		#tag EndViewProperty
		#tag ViewProperty
			Name="Index"
			Visible=true
			Group="ID"
			InitialValue="-2147483648"
			InheritedFrom="Object"
		#tag EndViewProperty
		#tag ViewProperty
			Name="Left"
			Visible=true
			Group="Position"
			InitialValue="0"
			InheritedFrom="Object"
		#tag EndViewProperty
		#tag ViewProperty
			Name="Name"
			Visible=true
			Group="ID"
			InheritedFrom="Object"
		#tag EndViewProperty
		#tag ViewProperty
			Name="Super"
			Visible=true
			Group="ID"
			InheritedFrom="Object"
		#tag EndViewProperty
		#tag ViewProperty
			Name="Top"
			Visible=true
			Group="Position"
			InitialValue="0"
			InheritedFrom="Object"
		#tag EndViewProperty
	#tag EndViewBehavior
End Class
#tag EndClass
